All Functions Used on PO11Q

factor

{base}

Create a factor

filter

{dplyr}

Filter out rows of a data frame according to logical vector

prop.test

{stats}

Test of Equal or Given Proportions

qt

{stats}

Quantile function for t-distribution

with

{base}

evaluate expression in the context of a data frame

order

{base}

Get indexes that will sort a vector

levels

{base}

Get levels of a factor

scale_x_continuous

{GGPLOT2}

Customise continuous x axis

slice

{dplyr}

Select rows by position

rm

{base}

Remove objects

ungroup

{dplyr}

Resolve grouping created with “group_by”

geom_histogram

{GGPLOT2}

Generates a histogram

rnorm

{base}

Generate random numbers from a normal distribution

ifelse

{base}

Return a or b depending on the value of test

range

{base}

Return range of values

recode_factor

{dplyr}

Recode factor values, changing the levels and their order

mean

{base}

Get mean of a vector

sd

{stats}

Get standard deviation of a vector

ls

{base}

Return a vector of character strings giving the names of the objects in the specified environment

as.numeric

{base}

Coerce a vector to numeric

select

{dplyr}

Select columns from a tibble/data frame

setwd

{base}

Set Working Directory

data.frame

{base}

Create a data.frame from vectors

tibble

{tibble}

A modern data frame from the tidyverse

as.character

{base}

Coerce a vector to character

read_dta

{haven}

Read a .dta file (Stata data)

install.packages

{utils}

Install R packages

table

{base}

Obtain frequency table of a variable/cross-tabulation of two variables

is.na

{base}

Check if a value is NA/elements of vector are NA

recode

{dplyr}

Recode a variable

exists

{base}

Test whether a named object/variable exists

cat

{base}

Concatenate and print objects to the console without quotes or indices

scale_y_continuous

{GGPLOT2}

Customise continuous y axis

labs

{GGPLOT2}

Customise labels in GGPLOT2

round

{base}

Rounds numbers

group_by

{dplyr}

Group tibble/data.frame by a factor variable. All further tidyverse operations are performed group-wise

plot

{graphics}

Generic function from base R to produce a plot

pwr.t.test

{pwr}

Calculate power, sample size, or effect size for t-tests

library

{base}

Load an R package

c

{base}

Combine values/vectors into a vector

head

{utils}

Show first 5 rows of a data frame

write_dta

{haven}

Write Stata files

spread

{tidyr}

Spread a key-value pair across multiple columns

aggregate

{stats}

Compute summary statistics of data subsets / by groups

summary

{base}

Obtain summary statistics or detailed regression output

write.csv

{utils}

write a csv file to a data frame

expression

{base}

Used in plots to add symbols to axes

cut

{base}

Convert Numeric to Factor

which.min

{base}

Return the index of the smallest value in a vector

install_rsthemes

{rsthemes}

Install the rsthemes collection of RStudio themes

arrange

{dplyr}

Sort values of data frame according to a variable/combination of variables

theme_classic

{GGPLOT2}

A minimalistic theme with no gridlines

power.t.test

{stats}

Power calculations for one- and two-sample t-tests

names

{base}

Get or set names of an object

separate

{tidyr}

Split columns

coord_cartesian

{GGPLOT2}

Zoom into a plot region without removing data (set Cartesian axis limits)

boxplot

{graphics}

Plot a simple box plot

geom_hline

{GGPLOT2}

Add a horizontal line in GGPLOT2

seq

{base}

Create a sequence

str

{utils}

Get the structure of an R object

sapply

{base}

Apply a function over a vector or list and simplify the result

max

{base}

Get maximum of a vector

summarize

{dplyr}

Collapse the dataset to a summary statistic (American-spelling alias of summarise)

ordered

{dplyr}

Create an ordered factor

View

{base}

View a data frame

stat_ecdf

{GGPLOT2}

Compute empirical cumulative distribution

which.max

{base}

return index of the largest value in a vector

n

{dplyr}

The number of observations in the current group.

quantile

{stats}

Obtain empirical quantiles of a vector

pt

{stats}

Calculate the cumulative distribution function of the t-distribution

sqrt

{base}

Square-root function

factor

{base}

Create factor variables

mutate

{dplyr}

Create new variables

aes

{GGPLOT2}

Construct aesthetic mapping of a ggplot graph

subset

{base}

Return subsets of vectors, matrices or data frames which meet conditions.

median

{stats}

Get median of a vector

summarise

{dplyr}

collapse the dataset to a summary statistic. Usually used with group_by()

set.seed

{base}

Initialise a pseudorandom number generator.

desc

{dplyr}

Arrange in descending order

read.csv

{utils}

Read a csv file to data frame. Specify stringsAsFactors = FALSE to keep all string columns as characters

t.test

{stats}

Performs one and two sample t-tests on vectors of data.

geom_line

{GGPLOT2}

Generates a line

sum

{base}

Get sum of numeric values or a vector

save

{base}

Save R objects

sprintf

{base}

C-style formatted string printing

hist

{graphics}

Plot a simple histogram

theme_minimal

{GGPLOT2}

A minimalistic theme with no background annotations

ceiling

{base}

Round numbers up to the smallest following integer

min

{base}

Get minimum of a vector

length

{base}

Returns number of elements in an object

replicate

{base}

Repeatedly evaluate an expression (wrapper around sapply)

nrow

{base}

Get number of rows of a data frame

geom_abline

{GGPLOT2}

Add a reference line with a given slope and intercept

ggplot

{GGPLOT2}

Create a ggplot graph

read_excel

{readxl}

Read an Excel file

print

{base}

Print object to the console

complete.cases

{stats}

Find Complete Cases

var

{stats}

Calculate variance

The end!